﻿#light

open System
open System.Windows.Forms
open System.Drawing
open Twitter.Model

open System.Configuration

[<STAThread>]
Application.EnableVisualStyles()

let twitterStore:ITwitterStore = AuthedTwitterStore(ConfigurationManager.AppSettings.["twitterUsername"], ConfigurationManager.AppSettings.["twitterPassword"]) :> ITwitterStore

let CreateScrollablePanel() =
    let panel = new FlowLayoutPanel(AutoScroll=true, BorderStyle=BorderStyle.FixedSingle, Dock=DockStyle.Fill)
    panel
    
let FillPanelWithStuff(panel:FlowLayoutPanel) =
    for status:Status in twitterStore.GetTimeline() do
        panel.Controls.Add(new Label(Text=status.Owner.Name + " -- says -- " + status.Text, MinimumSize=Size(400,40)))
    panel

        
let form = new Form(Text="TwitterPig", Size=new Size(400,600))

form.Controls.Add(CreateScrollablePanel () |> FillPanelWithStuff)
form.PerformLayout()
form.Show()

Application.Run(form)